<%@ page contentType="text/html;charset=utf-8" language="java"
	pageEncoding="UTF-8" import="java.util.Date"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>	
<ul class="menu-box">
	 <c:forEach items="${menus}" var="item" varStatus="itemStatus">  
		<li>
			<a 
				class="leavel-1 leavel-item"
				<c:choose>
		           <c:when test="${item.adminMenu.isDisMenu == '1' }">

		           </c:when>					 
					<c:otherwise>
						href="${item.adminMenu.menuUrl}"	
						target="mainFrame"			
					</c:otherwise>
				</c:choose>         		
			>
				<i class="runmi-icon leavel-icon  ${item.adminMenu.menuIco}"></i>
				 ${item.adminMenu.menuName}
				 <c:if test="${item.adminMenu.isDisMenu==1}">
					<i class="arrow-right runmi-icon"></i>
				 </c:if>
			</a>
			<c:if test="${item.adminMenu.isDisMenu==1}">	      
				<ul class="menu-2 menu-sub-box">
					<c:forEach items="${item.items}" var="citem" varStatus="itemStatus">
						<li><a class="leavel-2 leavel-item"  href="${citem.menuUrl}" target="mainFrame">${citem.menuName}</a></li>
					</c:forEach>					
				</ul>
		    </c:if>      
		</li>
	 </c:forEach>
</ul>

<script>
//左侧菜单配置
var leftMenuGreator = (function () {
	//给每一个菜单绑定事件
	var bindEvt = function bindEvt($parent) {
		$parent.find('.leavel-1').click(function () {
			var $this = $(this),
				$parentLi = $this.parents('li').eq(0),
				$siblingsUl = $this.siblings('ul'),
				isOpen = $parentLi.hasClass('open');
			if (!isOpen) {
				$parent.find('.open').removeClass('open').find('ul.menu-sub-box').slideUp().find('li.active').removeClass('active');
			}
			$parentLi[isOpen ? 'removeClass' : 'addClass']('open').find('ul.menu-sub-box').stop()[isOpen ? 'slideUp' : 'slideDown']();

		})
		$parent.find('.leavel-2').click(function () {
			var $li = $(this).parents('li').eq(0);
			if(!$li.hasClass('active')){
                $li.addClass('active').siblings('li').removeClass()
			}
        })
	}
	//开始
	return function start($parent) {
		bindEvt($parent);
	};
}());
leftMenuGreator($('#leftMenu'));
</script>